package cn.lijiajia3515.cairo.auth.modules.department;

import cn.lijiajia3515.cairo.core.business.DefaultBusiness;
import cn.lijiajia3515.cairo.core.exception.BusinessException;
import cn.lijiajia3515.cairo.core.page.Page;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DepartmentClientFallbackFactory implements FallbackFactory<DepartmentClient> {
	@Override
	public DepartmentClient create(Throwable cause) {
		return new DepartmentClient() {

			@Override
			public List<Department> find(FindDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public Page<Department> findPage(FindDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public List<DepartmentTreeNode> findTree() {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public List<PathDepartment> findId(String id) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public List<PathDepartment> findAncestor(FindDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public Department save(SaveDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public Department modify(ModifyDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public List<Department> delete(DeleteDepartmentParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}
		};
	}
}
